package 练习;

import java.util.Arrays;
import java.util.Collections;
import java.util.IntSummaryStatistics;
import java.util.List;
import java.util.stream.Collector;
import java.util.stream.Collectors;

public class t11 {
    public static void main(String[] args) {
        Integer[] igs = {1,2,3,4};
        IntSummaryStatistics intSummaryStatistics = Arrays.stream(igs).mapToInt(x -> x).summaryStatistics();
        System.out.println(intSummaryStatistics.getMax());
        System.out.println(intSummaryStatistics.getMin());
        System.out.println(intSummaryStatistics.getAverage());
        System.out.println(intSummaryStatistics.getCount());
        int[] is = Arrays.stream(igs).mapToInt(x->x).toArray();
        List<Integer> l1 = Arrays.stream(is).boxed().collect(Collectors.toList());
        List<Integer> l2 = Arrays.stream(igs).collect(Collectors.toList());
        List<Integer> l3 = Arrays.asList(igs);
        System.out.println(l1);
        System.out.println(l2);
        System.out.println(l3);
        Integer[] igs2 = l3.toArray(new Integer[0]);
        System.out.println(Arrays.toString(igs2));
        System.out.println(Arrays.toString(is));

        char[] chars = {'i','m','a','b','o','y'};
        String str = new String(chars);
        System.out.println(str);
        Integer[] ans = Arrays.stream(is).boxed().filter(x->x>2).toArray(Integer[]::new);
        System.out.println(Arrays.toString(ans));
    }
}
